package org.shiro.listener.shiro;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Shiro.Session相关操作监听器
 *
 * @author LiKun
 * @date 2021/11/3 9:32
 */
@Component
public class ShiroSessionListener implements SessionListener {
    private static final Logger logger = LoggerFactory.getLogger(ShiroSessionListener.class);

    @Override
    public void onStart(Session session) {
        logger.info("开始创建Session：{}", session.getId());
    }

    @Override
    public void onStop(Session session) {
        logger.info("Session创建停止：{}", session.getId());
    }

    @Override
    public void onExpiration(Session session) {
        logger.info("Session：{}已过期", session.getId());
    }
}
